package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_ZHAO_SHANG_WAR_REPORT_INFO_SYNC, desc = "战报同步-登录发起-只同步玩家项目个数")
public class ZsWarReportSyncCmd  extends CrossCommand {

    long playerId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        playerId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
//        List<ZsWarReport> reportList = ZsMgr.getAndUpdateZsWarReportList(serverId, packet.getPlayerId());
//        if(reportList.size() == 0){
//            return;
//        }
//        ZhaoShangProto.ZsPlayerWarReportSyncMsgFromCross.Builder respMsg = ZhaoShangProto.ZsPlayerWarReportSyncMsgFromCross.newBuilder();
//        for(ZsWarReport zsWarReport : reportList){
//            ZhaoShangProto.ZsWarReportInfoTemp.Builder builder = ZhaoShangPb.parseToZsWarReportTemp(zsWarReport);
//            respMsg.addReportList(builder);
//        }
//        MessageHelper.sendChannelPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.S_ZS_WAR_REPORT_SYNC_FROM_CROSS, respMsg));
    }

    @Override
    public void sendData() {
        //下发玩家的项目参与信息
        ZsMgr.sendPlayerProjectStateInfo(serverId, playerId);
    }
}
